/**
 * @file    Expression classname is undefined on line 2, column 15 in Templates/Classes/Class.java.
 * @author  Haseeb Yousaf
 * @see     LICENSE (MIT style license file)
 * @version 1.0
 * @date    Nov 10, 2011 12:13:09 PM
 */
package carrello.model.entities;
import carrello.util.EntityManagerUtil;
import javax.persistence.*;
@NamedQueries({
        @NamedQuery(name = "getCompanyByName", query = "from Company c")
        })

@Entity
@Table(name = "Company")
public class Company {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "company_id")
    private int companyId;
    private String name;
    private String slogan;
    private String url;
    private String email;
    private String phone;
    private String address;
    
    public Company() {}
    public Company( String name, String slogan, String url, String email, String phone, String address)
    {
        this.name      = name;
        this.slogan    = slogan;
        this.url       = url;
        this.email     = email;
        this.phone     = phone;
        this.address   = address;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSlogan() {
        return slogan;
    }

    public void setSlogan(String slogan) {
        this.slogan = slogan;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
    
    public static Company getCompanyByName() {
        Company company = (Company)EntityManagerUtil.getEntityManager().getQuery("getCompanyByName").uniqueResult();
                                    
        return company;
    }
    
}
